a=int(input())
for i in range(a):
b=list(map(int,input().split()))
c=list(map(int,input().split()))
N=b[0]
K=b[1]
if K==1:
print((N-1)//2)
else:
sum=0
for j in range(1,N-1):
if c[j]>c[j-1]+c[j+1]:
sum+=1
print(sum)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,c,d,e,ee,p[200005];
int main(){
scanf("%lld",&a);
while(a--){
d=0;
ee=0;
scanf("%lld%lld",&b,&c);
for(int i=1;i<=b;i++){
scanf("%lld",&p[i]);
}
for(int i=2;i<=b-1;i++){
if(p[i]>p[i-1]+p[i+1]){
d++;
}
}
if(c==1){
if(b%2==1)
printf("%lld\n",b/2);
else
printf("%lld\n",b/2-1);
}else
printf("%lld\n",d);
}
}
1538A - Stone Game | 1454C - Sequence Transformation |
165B - Burning Midnight Oil | 17A - Noldbach problem |
1350A - Orac and Factors | 1373A - Donut Shops |
26A - Almost Prime | 1656E - Equal Tree Sums |
1656B - Subtract Operation | 1656A - Good Pairs |
1367A - Short Substrings | 87A - Trains |
664A - Complicated GCD | 1635D - Infinite Set |
1462A - Favorite Sequence | 1445B - Elimination |
1656C - Make Equal With Mod | 567A - Lineland Mail |
1553A - Digits Sum | 1359B - New Theatre Square |
766A - Mahmoud and Longest Uncommon Subsequence | 701B - Cells Not Under Attack |
702A - Maximum Increase | 1656D - K-good |
1426A - Floor Number | 876A - Trip For Meal |
1326B - Maximums | 1635C - Differential Sorting |
961A - Tetris | 1635B - Avoid Local Maximums |